#include<iostream>
#include<mutex>
#include<condition_variable>
#include<atomic>
using namespace std;

int func(int k) {
	static int i = k;
	return ++i;
}

class Test {
public:
	void func() {
		cout << "func in Test" << endl;
	}

	~Test() {
		cout << "~Test in Test" << endl;
	}
};

class Derive:public Test {
public:
	void func() {
		cout << "func in Derive" << endl;
	}

	~Derive() {
		cout << "~Derive in Derive" << endl;
	}
};

int main() {
	for (int i = 0; i < 4; ++i) {
		cout << func(i) << endl;
	}
	cout << func(1) << endl;

	std::unique_ptr<Test>up(new Derive());
	up->func();

	std::atomic<int>flag;
}